<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        a {
            display: block;
            text-decoration: none;
        }

        li {
            list-style: none;
        }

        .slide-container {
            overflow: hidden;
            position: relative;
            width: 402px;
            height: 182px;
            margin: 100px auto;
            border: 1px solid black;
        }

        .slide-list,
        #slide-item,
        #slide-link {
            width: 100%;
            height: 100%;
        }

        #slide-img {
            vertical-align: top;
            width: 100%;
            height: 100%;
        }

        .slide-list {
            display: flex;
            transition: all 0s;
        }

        #slide-item {
            flex-shrink: 0;
        }
        #dot-list{
            width: 120px;
            position: absolute;
            bottom: 10px;
            left: 50%;
            margin-left: -60px;
            display: flex;
            justify-content: space-between;
        }
         #dot-item{
            width: 20px;
            height: 20px;
            border-radius: 10px;
            background-color:#fff ;
        }
        #dot-list .cur{
            background-color:aqua;
        }
        button{
            width: 100px;
            height: 100px;
        }
    </style>
</head>

<body>
    <div class="slide-container" id="slide-container">
        <ul class="slide-list" id="slide-list">
            <li id="slide-item"><a href="###" id="slide-link"><img src="images/banner1.jpg" alt="" id="slide-img"></a>
            </li>
            <li id="slide-item"><a href="###" id="slide-link"><img src="images/banner2.jpg" alt="" id="slide-img"></a>
            </li>
            <li id="slide-item"><a href="###" id="slide-link"><img src="images/banner3.jpg" alt="" id="slide-img"></a>
            </li>
            <li id="slide-item"><a href="###" id="slide-link"><img src="images/banner4.jpg" alt="" id="slide-img"></a>
            </li>
            <li id="slide-item"><a href="###" id="slide-link"><img src="images/banner5.jpg" alt="" id="slide-img"></a>
            </li>
        </ul>
    </div>
    <button id="prve">prve</button>
    <button  id="next">next</button>
    <script src="slider.js"></script>
    <script src="hummer.js"></script>
    <script>
        var slideEl=document.getElementById('slide-container')
        var prve=document.getElementById('prve')
        var next=document.getElementById('next')
     var slider=new setSlider(slideEl,{
        initindex:0,
        speed:0,
        isdot:true
     }
     ) ; 
     var hammer=new Hammer(slider.slide_list)
     var lock=false;
     hammer.on('panmove',function(ev){

       var distance=ev.deltaX+slider.setdistancebyindex(slider.index)
       slider.move(distance)
     })
     hammer.on('panend',function(ev){
        if(lock) return
        var distance=ev.deltaX+slider.setdistancebyindex(slider.index)
        var index=0;
        if(-distance>0){
            index=4
        }else{
            index=Math.round(distance/slider.distance);
        }
        slider.to(index)
     })
     hammer.on('swipeleft',function(){
        lock=true
         slider.prve(function(){
            lock=false
         })
     })
 
     hammer.on('swiperight',function(){
        lock=true
         slider.next(function(){
            lock=false
        })
     })

     prve.onclick=function(){
        slider.prve()
     }

     next.onclick=function(){
        slider.next()
     }
    </script>
   
</body>

</html>